#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int pivotIndex(int* nums, int numsSize) {
    int left = 0;
    int right = numsSize - 1;
    
    for (int i = 1; i < numsSize - 2; i++)
    {
int sum1 = 0;
    int sum2 = 0;
        left = 0;
       right = numsSize - 1;
        while (left < i)
        {
            sum1 += nums[left];
            left++;
        }
        while (right > i)
        {
            sum2 += nums[right];
            right--;
        }
        if (sum1 == sum2)
            return i;
    }

    return -1;
}
int main()
{
    int nums[] = { 1,7,3,6,5,6 };
    int numsSize = sizeof(nums) / sizeof(nums[0]);
   int ret= pivotIndex( nums,  numsSize);
   printf("%d", ret);
}